home *** CD-ROM | disk | FTP | other *** search
- Path: news.cuny.edu!apccu
- From: Paul Abrilla <APCCU@CUNYVM.CUNY.EDU>
- Newsgroups: comp.lang.c++
- Subject: Help on C++ error
- Date: Wed, 10 Jan 1996 11:25:07 EST
- Organization: City University of New York/University Computer Center
- Message-ID: <96010.112507APCCU@CUNYVM.CUNY.EDU>
- NNTP-Posting-Host: cunyvm.cuny.edu
- Disclaimer: Author bears full responsibility for this post
-
- Hi to all,
-
- I'm just starting to code on C++, and was playing around with classes and
- came across an error and a warning when I try to compile the code below.
- The warning is complaining about the statement, 'int Cat::SetAge(age)'.
- It says, 'Style of function definition is now obsolete'. I'm sorry I couldn't
- check my compiler's manual at this time. On the other hand, the error says,
- 'Cat::SetAge(int)' is not a member of 'Cat' (line:19). Any help will be
- appreciated. Please send replies directly tp my account. Thanks in advance.
-
- By the way, I'm using Turbo C++ for windows 3.1 by Borland. Thanks again../Paul
-
- #include <iostream.h>
-
- class Cat
- {
- public:
- int GetAge();
- void SetAge (int age);
- void Meow();
- private:
- int itsAge;
- };
-
- int Cat::GetAge()
- {
- return itsAge;
- }
-
- int Cat::SetAge(age)
- {
- itsAge = age;
- }
-
- void Cat::Meow()
- {
- cout << "Meow..meow...\n";
- }
- void main()
- {
- Cat Frisky;
- Frisky.SetAge(5);
- Frisky.Meow();
- cout << "Frisky is a cat who is ";
- cout << Frisky.GetAge() << " years old.\n";
- Frisky.Meow();
- }
-
-